<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

  <% js_bundle :edit_rubric %>
  <% css_bundle :learning_outcomes %>

  <% if can_do(@assignment, @current_user, :update) %>
    <%# HACK! this is here because edit_rubric.js expects there to be a #add_rubric_url on the page and sets it's <form action="..."> to it %>
    <a href="<%= context_url(@context, :context_rubrics_url) %>" id="add_rubric_url" style="display: none;"></a>
  <% end %>

  <div id="rubrics" style="margin-bottom: 10px;">
    <% if @assignment.rubric_association && @assignment.rubric_association.rubric %>
      {{> views/shared/rubric}}
    <% end %>
    <div style="display: none;" id="rubric_parameters">
      <input type="hidden" name="rubric_association[association_type]" value="Assignment"/>
      <input type="hidden" name="rubric_association[association_id]" value="<%= @assignment.id %>"/>
      <input type="hidden" name="rubric_association[purpose]" value="grading"/>
    </div>
    <% if can_do(@assignment, @current_user, :update) %>
      {{> views/shared/rubric_dialog}}
    <% end %>
    {{> views/shared/rubric_criterion_dialog}}
  </div>
  {{> views/shared/rubric}}
  <% if can_do(@assignment, @current_user, :update) %>
    <div style="text-align: center; font-size: 1.2em; margin-top: 10px; display: none;">
      <a href="<%= context_url(@context, :context_rubrics_url) %>" class="add_rubric_link rubric" style="<%= hidden if @assignment.rubric_association %>"><%= t 'links.assign_rubric', 'Assign Rubric' %></a>
    </div>
    {{> views/shared/rubric_forms}}
  <% end %>
  {{> views/shared/sequence_footer}}
